﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Star_Helper;
public partial class Gupload_showfile : System.Web.UI.Page
{
    protected void Page_Init(object sender, EventArgs e)
    {       
        int lb = Convert.ToInt32(MostUse2.urlVal("lb", "1"));
        string danhao = MostUse2.urlVal("tid");
        string doType = MostUse2.urlVal("type", "viewfj");
      
        if (danhao.Length > 3)
        {
             if (lb == 1)
             {
                switch (doType)
                {
                    case "viewfj":
                        Page.Title = "附件中心_" + danhao;
                        string apicheck = MostUse2.urlVal("apicheck");
                        if (apicheck == Api_sys.apiCheckCode("q"))
                        {
                            showfjzy.Text = saveFile.fileCountTxt(danhao);
                            hiddenVal.Text = string.Format("<input type='hidden' id='getdh' name='getdh' value='{0}' />", danhao);

                            showtable.Text = string.Format("{0}{1}", cleanInput.replaceXiaoshu(starLibs_plus.getEditTable(2, 2, "fujianedit", "FilesCenter", "uid,filename1,djname,filesize/1024 as fsize,beizhu,eday,orderview,yxbz,jltime,jluser", "文件名#readtxt#0#196px#1-50-1,分类#sbox#0#120px#0-30#fjfl_co,大小（KB）#readtxt#0#72px#0,备注#txt#0#196px#0,有效期#day#0#100px#10-10,排序#num#0#60px#1-3,状态#sbox2#0#60px#0#[1-在用;0-停用],上传时间#readtxt#0#120px#0,操作员#readtxt#0#72px#0", "", "0-1-0", "orderview", " (Danhao ='Q:tid'  and ucocode='Q:cocode') "), 1, 2), starLibs_plus.getBottomSave());

                            if (!MobileInfos.isMobile())
                            {
                                showother.Text = saveFile.otherFiledb(danhao, "../jup2016/upfiles");
                            }
                            else
                            {
                                jsimg.Text = saveFile.ImgFiledb2(danhao, "../jup2016/upfiles/");
                                showother2.Text = saveFile.otherFiledb2(danhao, "../jup2016/upfiles");
                            }
                        }
                        else
                        {
                            Response.Write("接口校验码有误或校验码已过期，请尝试重新打开！");
                            Response.End();
                        }
                        break;
                    case "getpcimg":
                        Response.Write(saveFile.ImgFiledb(danhao, "../jup2016/upfiles"));
                        Response.End();
                        break;
                }

            }
            else if (lb == 2)
            {
                dataFunc saveFunc = new dataFunc();
                string rtxt = "";
                switch (doType)
                {
                    case "viewfj":
                        rtxt = starLibs_plus.autoSaveFrom(2, "", "", "", "", "Q:tid", 1, 0);
                        rtxt = rtxt == "1" ? "成功保存" : "保存失败";

                        break;

                }

                Response.Write(rtxt); Response.End();
            }
            else
            {
                Response.Write("无单号，无法显示.");
                Response.End();
            }
        }



    }
}